package ${packageName}.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import ${packageName}.dto.req.${addReqDto};
import ${packageName}.dto.req.${updateReqDto};
import ${packageName}.dto.req.${queryPageReqDto};
import ${packageName}.dto.res.${queryResDto};
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;

import ${packageName}.service.${serviceName};

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@Api(value = "${tableComment}", tags = "${tableComment}")
@RequestMapping("/${entityNameLower}")
public class ${controllerName} {

	@Resource
	private ${serviceName} ${serviceNameLower};

	@ApiOperation(value = "分页查询${tableComment}")
	@GetMapping("/page")
	public IPage<${queryResDto}> query${entityName}Page(${queryPageReqDto} reqDto){
		return ${serviceNameLower}.query${entityName}Page(reqDto);
	}

	@ApiOperation(value = "保存${tableComment}")
	@PostMapping("/save")
	public Boolean save(@RequestBody ${addReqDto} reqDto) {
		return ${serviceNameLower}.add${entityName}(reqDto);
	}

	@ApiOperation(value = "修改${tableComment}")
	@PostMapping("/update")
	public Boolean update(@RequestBody ${updateReqDto} reqDto) {
		return ${serviceNameLower}.update${entityName}(reqDto);
	}

	@ApiOperation(value = "批量删除${tableComment}")
	@PostMapping("/deleteBatch")
	public Boolean deleteBatch(@RequestBody List<Long> ids) {
		return ${serviceNameLower}.deleteBatch(ids);
	}

}